







[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Generates all the possible permutations of the items in collection. If collection
has N items, then N factorial permutations will be generated. This method does not compare the items to determine if
any of them are equal. If some items are equal, the same permutation may be generated more than once. For example,
if the collections contains the three items A, A, and B, then this method will generate the six permutations, AAB, AAB,
ABA, ABA, BAA, BAA (not necessarily in that order). To take equal items into account, use the GenerateSortedPermutations
method.
Namespace: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
C# |
---|
public static IEnumerable<T[]> GeneratePermutations<T>( IEnumerable<T> collection ) |
Visual Basic (Declaration) |
---|
Public Shared Function GeneratePermutations(Of T) ( _ collection As IEnumerable(Of T) _ ) As IEnumerable(Of T()) |
Visual C++ |
---|
public: generic<typename T> static IEnumerable<array<T>^>^ GeneratePermutations ( IEnumerable<T>^ collection ) |
Parameters
- collection
- IEnumerable<(Of <T>)>
The collection of items to permute.
Return Value
An IEnumerable<T[]> that enumerations all the possible permutations of the items in collection. Each permutations is returned as an array. The items in the array should be copied if they need to be used after the next permutation is generated; each permutation may reuse the same array instance.
Type Parameters
- T
- The type of items to permute.
See Also
Algorithms Class
Wintellect.PowerCollections Namespace